package com.heima.behavior.config;

import com.heima.common.excpetion.CustException;
import com.heima.model.behavior.pojos.ApBehaviorEntry;
import com.heima.model.behavior.pojos.ApUnlikesBehavior;
import com.heima.model.common.enums.AppHttpCodeEnum;
import com.heima.model.threadlocal.AppThreadLocalUtils;
import com.heima.model.user.pojos.ApUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class GetUser {
    @Autowired
    private MongoTemplate mongoTemplate;

    /**
     *
     * @return
     */
    public ApUser getApUser() {
        ApUser user = AppThreadLocalUtils.getUser();
        if (user == null)
            CustException.cust(AppHttpCodeEnum.PARAM_REQUIRE);

        return user;
    }
}
